-
Notifications
You must be signed in to change notification settings - Fork 394
Adding DscExamplesPresent rule #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding DscExamplesPresent rule #95
Conversation
/// <returns>The results of the analysis</returns> | ||
public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName) | ||
{ | ||
String fileNameOnly = fileName.Substring(fileName.LastIndexOf("\\", StringComparison.Ordinal) + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use Path.GetFileName("fileName")
if (!examplesPresent) | ||
{ | ||
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.DscExamplesPresentNoExamplesError, resourceName), | ||
null, GetName(), DiagnosticSeverity.Information, fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to use the dscClass.Extent here for the extent instead of null
Looks good to me. |
Adding DscExamplesPresent rule
Merged pull request |
Adding DscExamplesPresent rule (addressing Issue #84 )
DscExamplesPresent: Checks that DSC examples for given resource are present.
Rule expects directory Examples to be present:
For non-class based resources it should exist at the same folder level as DSCResources folder.
For class based resources it should be present at the same folder level as resource psm1 file.
Examples folder should contain sample configuration for given resource - file name should contain resource's name.